package com.zhaozhaonews.util.thread;


import com.zhaozhaonews.model.user.entity.ApUser;

/**
 * @author WanJl
 * @version 1.0
 * @title AppThreadLocalUtil
 * @description
 * @create 2025/2/22
 */
public class AppThreadLocalUtil {

    private final static ThreadLocal<ApUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     * @param wmUser
     */
    public static void setUser(ApUser wmUser){
        WM_USER_THREAD_LOCAL.set(wmUser);
    }

    /**
     * 获取用户
     */
    public static ApUser getUser(){
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
